package cn.echo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by Administrator on 2017/5/15.
 */
@Controller //标明这个类是一个controller
@RequestMapping("hello")
public class HelloControllerByAnnotation {
    //如果说想要请求到此方法需要---
    // http://localhost:8080/上下文路径/类的mapping/方法的mapping
    // http://localhost:8080/hello/index
    @RequestMapping("index")
    public String hello(Model model){
        model.addAttribute("hello","我是hello方法");
        System.out.println("hello 我hello方法");
        return "hello";//return就是ModelAndView的view
    }

}
